MyModel::truncate();
foreach ($tableNames as $name) {
//if you don't want to truncate migrations
if ($name == 'migrations') {
continue;
}
DB::table($name)->truncate();
}
Schema::enableForeignKeyConstraints();
Visitor::query()->truncate();
Schema::disableForeignKeyConstraints();
$tableNames = Schema::getConnection()->getDoctrineSchemaManager()->listTableNames();